/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 言初
 * Date: 2023-03-17
 * Time: 20:58
 */
import java.util.*;
public class Main{
    public static void main2(String[] args) {
        Scanner sc=new Scanner(System.in);
        //输入
        //int a=sc.nextInt();
        //String str=sc.next();
        //String  str2=sc.nextLine();
        int[] arr=new int[10];
        //int len1=str.length();
        int len2=arr.length;
        String str3=new String("abcdef");
        //字符串
        str3.charAt(2);
        char[] ch=str3.toCharArray();
        int b=str3.indexOf("ab");
        int c=str3.lastIndexOf("cd");
        boolean bool=str3.contains("ac");
        //System.out.println(" "+c+bool);

        String stra=str3.toUpperCase();
        String strb=str3.toLowerCase();
        String[] strc=str3.split("c");
        //System.out.println(strc[1]);
        //System.out.println(str3.trim());
        //System.out.println(str3.replace(" ", ""));
        //System.out.println(str3.substring(2,3));
        String str4="AbcdEf";
        //System.out.println(str3.equals(str4));
        //System.out.println(str3.equalsIgnoreCase(str4));

        Map<Integer,Integer> map=new HashMap<>();
        //map
        for(int i=0;i<4;i++){
            map.put(i,i+1);
        }
        //Map<Integer,Integer> map2=new TreeMap<>(map);
        /*for(Integer i:map.keySet()){
            System.out.print(i+" ");
        }
        System.out.println();
        for(Integer i:map.values()){
            System.out.print(i+" ");
        }
        System.out.println();
        for(Map.Entry<Integer,Integer> entry:map.entrySet()){
            System.out.print(entry.getKey()+" "+entry.getValue()+" ");
        }
        System.out.println();*/
        for(Map.Entry<Integer,Integer> entry:map.entrySet()){
            System.out.print(entry.getKey()+" "+entry.getValue()+" ");
        }
        System.out.println();

        //System.out.println(map.containsKey(5));
        //System.out.println(map.containsValue(1));
        /*Set<Integer> set=new TreeSet<>();
        Iterator<Integer> it=set.iterator();
        while(it.hasNext()){
            System.out.print(it.next()+" ");
        }
        System.out.println();*/

        List<Integer> arraylist=new ArrayList<>();
        //顺序表
        arraylist.add(1);
        arraylist.add(3);
        arraylist.get(1);
        arraylist.set(0,4);
        //System.out.println(arraylist);
        List<Integer> linkedlist=new LinkedList<>();
        //链表
        linkedlist.add(3);
        linkedlist.add(6);
        linkedlist.remove(0);
        //System.out.println(linkedlist);
        Stack<Integer> stack=new Stack<>();
        //栈
        stack.push(3);
        stack.push(4);
        stack.push(5);
        //System.out.println(stack.peek());
        //System.out.println(stack.pop());
        //System.out.println(stack.empty());
        Queue<Integer> queue=new LinkedList<>();
        //队列
        queue.offer(2);
        queue.offer(3);
        queue.offer(4);
        //System.out.println(queue.peek());
        //System.out.println(queue.poll());

        //PriorityQueue<Integer> priorityQueue=new PriorityQueue<>();
        PriorityQueue<Integer> priorityQueue=new PriorityQueue<>();
        //堆默认是小堆
        //PriorityQueue<Integer> priorityQueue1=new PriorityQueue<>((o1,o2)->{return o2.compareTo(o1);});
        PriorityQueue<Integer> priorityQueue1=new PriorityQueue<>((o1,o2)->{return o2.compareTo(o1);});
        //这个就已经被修改成了大堆了
        priorityQueue.offer(2);
        priorityQueue.offer(3);
        priorityQueue.peek();
        priorityQueue.poll();

        StringBuilder stringBuilder=new StringBuilder("abcdef");
        String str=new String("abcd");
        String s1=stringBuilder.toString();
        StringBuilder s=new StringBuilder(str);
        //System.out.println(s1);
        //System.out.println(s);

        stringBuilder.append(2);
        stringBuilder.append(3);
        stringBuilder.append(4);
        stringBuilder.deleteCharAt(2);
        stringBuilder.setCharAt(1,'9');
        stringBuilder.indexOf("3");
        stringBuilder.insert(2,8);
        //System.out.println(stringBuilder);

        double d=12.456;
        //System.out.println(String.format("%.2f",d));
        //System.out.println(String.format("%.1f",d));

        char ch1='1';
        int m=12;
        String str6="14";
        int m1=Integer.parseInt(str6);
        //System.out.println(m1);

        String str7=Integer.toString(m);
        String  str8=String.valueOf(m);
        String str9=new String(arr,0,arr.length);
    }




    public static void main1(String[] args){
        //简单计算器
        Scanner sc=new Scanner(System.in);
        Stack<Integer> stack1=new Stack<>();
        Stack<Character> stack2=new Stack<>();
        int n=sc.nextInt();
        for(int i=0;i<n;i++){
            int ret=sc.nextInt();
            stack1.add(ret);
        }
        for(int i=0;i<n-1;i++){
            char ch=sc.next().charAt(0);
            stack2.add(ch);
        }
        int h=0;//为0代表没有异常跳出
        while(!stack1.isEmpty() && !stack2.isEmpty()){
            int a1=stack1.pop();
            int a2=stack1.pop();
            char ch=stack2.pop();
            int mn=0;
            if(ch=='+'){
                mn=a2+a1;
            }else if(ch=='-'){
                mn=a2-a1;
            }else if(ch=='*'){
                mn=a2*a1;
            }else if(ch=='/'){
                if(a1==0){
                    System.out.println("ERROR: "+a2+"/0");
                    //    ERROR: X/0
                    h=1;
                    break;
                }else{
                    mn=a2/a1;
                }
            }
            stack1.add(mn);
        }
        if(h==0){
            System.out.println(stack1.pop());
        }

    }
}
